home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / favori / favorit1.frm < prev    next >
Text File  |  1995-05-08  |  18KB  |  596 lines

  1. VERSION 2.00
  2. Begin Form Form1 
  3.    BackColor       =   &H0080C0FF&
  4.    Caption         =   "Favorite Program Launcher"
  5.    ClientHeight    =   3990
  6.    ClientLeft      =   375
  7.    ClientTop       =   2085
  8.    ClientWidth     =   7845
  9.    FontBold        =   -1  'True
  10.    FontItalic      =   0   'False
  11.    FontName        =   "Courier"
  12.    FontSize        =   9.75
  13.    FontStrikethru  =   0   'False
  14.    FontUnderline   =   0   'False
  15.    ForeColor       =   &H00000000&
  16.    Height          =   4680
  17.    Icon            =   FAVORIT1.FRX:0000
  18.    Left            =   315
  19.    LinkMode        =   1  'Source
  20.    LinkTopic       =   "Form1"
  21.    ScaleHeight     =   3990
  22.    ScaleWidth      =   7845
  23.    Top             =   1455
  24.    Width           =   7965
  25.    Begin CommandButton DosButton 
  26.       Caption         =   "Shell to DOS"
  27.       Height          =   375
  28.       Left            =   240
  29.       TabIndex        =   2
  30.       Top             =   3240
  31.       Width           =   2895
  32.    End
  33.    Begin CommandButton CancelButton 
  34.       Caption         =   "Cancel"
  35.       Height          =   495
  36.       Left            =   6720
  37.       TabIndex        =   7
  38.       Top             =   3120
  39.       Visible         =   0   'False
  40.       Width           =   855
  41.    End
  42.    Begin CommandButton OKButton 
  43.       Caption         =   "OK"
  44.       Height          =   495
  45.       Left            =   5280
  46.       TabIndex        =   6
  47.       Top             =   3120
  48.       Visible         =   0   'False
  49.       Width           =   855
  50.    End
  51.    Begin CheckBox Check1 
  52.       BackColor       =   &H0080C0FF&
  53.       Caption         =   "Check1"
  54.       Height          =   255
  55.       Left            =   720
  56.       TabIndex        =   1
  57.       Top             =   3000
  58.       Width           =   255
  59.    End
  60.    Begin TextBox CommandlineName 
  61.       BackColor       =   &H00E0FFFF&
  62.       FontBold        =   -1  'True
  63.       FontItalic      =   0   'False
  64.       FontName        =   "MS Sans Serif"
  65.       FontSize        =   9.75
  66.       FontStrikethru  =   0   'False
  67.       FontUnderline   =   0   'False
  68.       Height          =   375
  69.       Left            =   5280
  70.       TabIndex        =   5
  71.       Top             =   2040
  72.       Visible         =   0   'False
  73.       Width           =   2295
  74.    End
  75.    Begin CommandButton BrowseButton 
  76.       BackColor       =   &H00C0C0C0&
  77.       Caption         =   "Pick A File"
  78.       Height          =   495
  79.       Left            =   6000
  80.       TabIndex        =   4
  81.       Top             =   960
  82.       Width           =   1095
  83.    End
  84.    Begin ListBox List1 
  85.       BackColor       =   &H00E0FFFF&
  86.       FontBold        =   -1  'True
  87.       FontItalic      =   0   'False
  88.       FontName        =   "MS Sans Serif"
  89.       FontSize        =   12
  90.       FontStrikethru  =   0   'False
  91.       FontUnderline   =   0   'False
  92.       Height          =   2130
  93.       Left            =   600
  94.       Sorted          =   -1  'True
  95.       TabIndex        =   0
  96.       Top             =   720
  97.       Width           =   2295
  98.    End
  99.    Begin TextBox PetName 
  100.       BackColor       =   &H00E0FFFF&
  101.       FontBold        =   -1  'True
  102.       FontItalic      =   0   'False
  103.       FontName        =   "MS Sans Serif"
  104.       FontSize        =   12
  105.       FontStrikethru  =   0   'False
  106.       FontUnderline   =   0   'False
  107.       Height          =   420
  108.       Left            =   5400
  109.       TabIndex        =   3
  110.       Top             =   240
  111.       Visible         =   0   'False
  112.       Width           =   1935
  113.    End
  114.    Begin PictureBox Picture1 
  115.       Height          =   495
  116.       Left            =   1560
  117.       Picture         =   FAVORIT1.FRX:0302
  118.       ScaleHeight     =   465
  119.       ScaleWidth      =   465
  120.       TabIndex        =   11
  121.       Top             =   120
  122.       Width           =   495
  123.    End
  124.    Begin Label Checklabel 
  125.       BackColor       =   &H0080C0FF&
  126.       Caption         =   "Minimize on Launch"
  127.       Height          =   255
  128.       Left            =   1080
  129.       TabIndex        =   8
  130.       Top             =   3000
  131.       Width           =   1815
  132.    End
  133.    Begin Label CommandlineLabel 
  134.       BackColor       =   &H0080C0FF&
  135.       Caption         =   "Command Line"
  136.       Height          =   255
  137.       Left            =   3960
  138.       TabIndex        =   10
  139.       Top             =   2160
  140.       Visible         =   0   'False
  141.       Width           =   1455
  142.    End
  143.    Begin Label Filenamelabel 
  144.       BackColor       =   &H00C0E0FF&
  145.       BorderStyle     =   1  'Fixed Single
  146.       Height          =   255
  147.       Left            =   4560
  148.       TabIndex        =   12
  149.       Top             =   1560
  150.       Width           =   3255
  151.    End
  152.    Begin Label PetnameLabel 
  153.       Alignment       =   2  'Center
  154.       BackColor       =   &H0080C0FF&
  155.       Caption         =   "Pet Name"
  156.       Height          =   255
  157.       Left            =   4080
  158.       TabIndex        =   9
  159.       Top             =   480
  160.       Visible         =   0   'False
  161.       Width           =   1095
  162.    End
  163.    Begin Menu AddMenu 
  164.       Caption         =   "&Add"
  165.    End
  166.    Begin Menu ChangeMenu 
  167.       Caption         =   "&Change"
  168.    End
  169.    Begin Menu DeleteMenu 
  170.       Caption         =   "&Delete"
  171.    End
  172.    Begin Menu UndeleteMenu 
  173.       Caption         =   "&Undelete"
  174.    End
  175.    Begin Menu HelpMenu 
  176.       Caption         =   "&Help"
  177.       Begin Menu HelpKey 
  178.          Shortcut        =   {F1}
  179.          Visible         =   0   'False
  180.       End
  181.    End
  182.    Begin Menu AboutMenu 
  183.       Caption         =   "&About"
  184.    End
  185. End
  186. 'GLOBALS TO FORM
  187. Dim MAINTSWITCH As String       'tells if "A"dd or "C"hange
  188. Dim TRUEFALSE As Integer        'used in subrte to swap visibility
  189. Dim FIRSTSWITCH As String       'used at load time for initialization
  190. Dim INIDATA As String           'work area
  191. Dim DELETEDITEMS(100)  As String  'array saves prior deletes
  192.                                   '  for UNDELETE menu item
  193.  
  194. ' display the "About" menu (Form3) when menu item clicked
  195. Sub AboutMenu_Click ()
  196.  
  197.  Load Form3                  'load the form
  198.  Form3.visible = True        'make it visible
  199.  Form3.COMMAND1.SetFocus     'change focus to forms "OK" button
  200.  
  201. End Sub
  202.  
  203. 'adds and changes to list of programs and FAVORITE.INI file
  204. 'are processed here
  205. '
  206. Sub add_to_list ()
  207.  If MAINTSWITCH = "C" Then     'came here by "C"hange
  208.   WORKITEM% = List1.listindex  'find item in list1 array
  209.  End If
  210.     
  211.     
  212.  If LTrim$(RTrim$(Petname.text)) = "" Then
  213.     Beep                     'user didn't enter PETNAME
  214.     response% = MsgBox("Enter information in Pet Name or Cancel your change.", 64, "Message")
  215.     Petname.SetFocus         'put cursor back at PETNAME
  216.     Exit Sub
  217.  ElseIf LTrim$(RTrim$(RUNFILENAME$)) = "" Then
  218.     Beep                      'user didn't enter PROGRAMNAME
  219.     response% = MsgBox("Enter program name information or Cancel the change.", 64, "Message")
  220.     Commandlinename.SetFocus  'put cursor back at PROGRAMNAME
  221.     Exit Sub
  222.  End If
  223.  
  224.  WORK% = Len(Petname.text)    'align the entered data so it
  225.  If WORK% >= 20 Then          'can be placed in list1 and .INI file
  226.     DATAWORK$ = UCase$(Left$(Petname.text, 20))
  227.  Else
  228.     DATAWORK$ = UCase$(Petname.text + String$(20 - WORK%, " "))
  229.  End If
  230.  WORK% = Len(RUNFILENAME$)
  231.     DATAWORK$ = DATAWORK$ + String$(10, " ") + RUNFILENAME$ + String$(50 - WORK%, " ")
  232.  
  233.  
  234.  WORK% = Len(Commandlinename.text) 'align COMMANDLINE
  235.  
  236.  If WORK% >= 32 Then
  237.      DATAWORK$ = DATAWORK$ + Left$(Commandlinename.text, 32)
  238.  Else
  239.      DATAWORK$ = DATAWORK$ + Commandlinename.text + String$(32 - WORK%, " ")
  240.  End If
  241.   
  242.  If MAINTSWITCH = "C" Then     'if change, remove old item from List1
  243.      List1.RemoveItem WORKITEM%
  244.  End If
  245.   
  246. MAINTSWITCH = ""          'not needed any further, clear
  247. List1.AddItem DATAWORK$   'add to list1
  248. Writefile                 'go to subrte to write FAVORITE.INI file
  249. Make_Boxes_Visible (False) 'hide the right side boxes & buttons
  250. Clear_the_fields          'clear the box texts
  251. End Sub
  252.  
  253. Sub AddCtl_Click ()
  254.  List1.visible = True        'make right side of form visible
  255.  Mak